package cn.cs.service;

import cn.cs.mapper.SysDtAreaMapper;
import cn.cs.pojo.SysDtArea;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class SysDtAreaService {

    @Resource
    private SysDtAreaMapper sysDtAreaMapper;

    @RequestMapping(value = "/getSysDtAreasByParId", method = RequestMethod.POST)
    public List<SysDtArea> getSysDtAreasByParId(@RequestParam("id") String id)throws Exception{
        return sysDtAreaMapper.getSysDtAreasByParId(id);
    }

    @RequestMapping(value = "/getSysDtAreaListByMap", method = RequestMethod.POST)
    public List<SysDtArea> getSysDtAreaListByMap(@RequestBody Map<String, Object> param)throws Exception{
        return sysDtAreaMapper.getSysDtAreaListByMap(param);
    }

    @RequestMapping(value = "/getAreaLastById", method = RequestMethod.POST)
    public Map<String, Object>	getAreaLastById(@RequestParam("id") String id)throws Exception{
        return sysDtAreaMapper.getAreaLastById(id);
    }

    @RequestMapping(value = "/getSysDtAreaById", method = RequestMethod.POST)
    public Map<String, Object>	getSysDtAreaById(@RequestParam("id") String id)throws Exception{
        return sysDtAreaMapper.getSysDtAreaById(id);
    }

    @RequestMapping(value = "/getAgentManageProAreas", method = RequestMethod.POST)
    public List<Map<String, Object>>	getAgentManageProAreas(@RequestBody Map<String, Object> param)throws Exception{
        return sysDtAreaMapper.getAgentManageProAreas(param);
    }

    @RequestMapping(value = "/getProvinceList", method = RequestMethod.POST)
    public List<Map<String, Object>> getProvinceList() throws Exception{
        return sysDtAreaMapper.getProvinceList();
    }

    @RequestMapping(value = "/getCityListByPid", method = RequestMethod.POST)
    public List<Map<String, Object>> getCityListByPid(@RequestParam("pId") String pId) throws Exception{
        return sysDtAreaMapper.getCityListByPid(pId);
    }

    @RequestMapping(value = "/getAreaListByPid", method = RequestMethod.POST)
    public List<Map<String, Object>> getAreaListByPid(@RequestParam("pId") String pId, @RequestParam("list") List<Map<String, Object>> list) throws Exception{
        return sysDtAreaMapper.getAreaListByPid(pId, list);
    }

    @RequestMapping(value = "/getAreasListByPid", method = RequestMethod.POST)
    public List<Map<String, Object>> getAreasListByPid(@RequestParam("pId") String pId) throws Exception{
        return sysDtAreaMapper.getAreasListByPid(pId);
    }

    @RequestMapping(value = "/getCityNameByAreaId", method = RequestMethod.POST)
    public Map<String, Object> getCityNameByAreaId(@RequestParam("areaId") String areaId) throws Exception{
        return sysDtAreaMapper.getCityNameByAreaId(areaId);
    }

    @RequestMapping(value = "/getAreaProvince", method = RequestMethod.POST)
    public List<Map<String, Object>> getAreaProvince(@RequestParam("list") List<Map<String, Object>> list) throws Exception{
        return sysDtAreaMapper.getAreaProvince(list);
    }

    @RequestMapping(value = "/getAreaCity", method = RequestMethod.POST)
    public List<Map<String, Object>> getAreaCity(@RequestParam("list") List<Map<String, Object>> list, @RequestParam("pId") String pId) throws Exception{
        return sysDtAreaMapper.getAreaCity(list, pId);
    }

    @RequestMapping(value = "/getAreaArea", method = RequestMethod.POST)
    public List<Map<String, Object>> getAreaArea(@RequestParam("list") List<Map<String, Object>> list, @RequestParam("pId") String pId) throws Exception{
        return sysDtAreaMapper.getAreaArea(list, pId);
    }

    @RequestMapping(value = "/getAreaListByProvinceId", method = RequestMethod.POST)
    public List<Map<String, Object>> getAreaListByProvinceId(@RequestParam("areaId") String areaId) throws Exception{
        return getAreaListByProvinceId(areaId);
    }

    @RequestMapping(value = "/getAreaListByCityId", method = RequestMethod.POST)
    public List<Map<String, Object>> getAreaListByCityId(@RequestParam("areaId") String areaId) throws Exception{
        return sysDtAreaMapper.getAreaListByCityId(areaId);
    }

    @RequestMapping(value = "/getAreaListById", method = RequestMethod.POST)
    public List<Map<String, Object>> getAreaListById(@RequestParam("areaId") String areaId) throws Exception{
        return sysDtAreaMapper.getAreaListById(areaId);
    }

}
